﻿using System.Collections.Generic;
using ZilLion.Service.ZilLionOss.Domain.Entitys;
using ZilLion.Service.ZilLionOss.Domain.Repositorys.Interface;
using ZilLion.Service.ZilLionOss.Domain.Services.Interface;

namespace ZilLion.Service.ZilLionOss.Domain.Services
{
    public class OssRouteService : IOssRouteService
    {
        private readonly IOssRouteCacheRepositrory _ossRouteCacheRepositrory;
        private readonly IOssRouteRepositrory _ossRouteRepositrory;
        
        public OssRouteService(IOssRouteCacheRepositrory ossRouteCacheRepositrory,
            IOssRouteRepositrory ossRouteRepositrory)
        {
            _ossRouteCacheRepositrory = ossRouteCacheRepositrory;
            _ossRouteRepositrory = ossRouteRepositrory;
        }

      
        public IList<OssRouteInfoEntity> GetRouteByCompanykey(string companykey)
        {
            return _ossRouteRepositrory.GetRouteByCompanykey(companykey);
        }

        public IList<OssRouteInfoEntity> GetRouteByCompanyModule(string companykey)
        {
            return _ossRouteRepositrory.GetRouteByCompanyModule(companykey);
        }

        public IList<OssRouteInfoEntity> GetAllRoute()
        {
            return _ossRouteRepositrory.GetAllRoute();
        }

        public void UpdateRouteJson(OssRouteJsonEntity jsonEntity, IList<OssRouteInfoEntity> ossRouteInfos)
        {
            _ossRouteCacheRepositrory.UpdateRouteJson(jsonEntity, ossRouteInfos);
        }

        public OssRouteJsonEntity GetRouteJson()
        {
            return _ossRouteCacheRepositrory.GetRouteJson();
        }


        public IList<OssRouteInfoEntity> GetRoleRoutes(long roleid)
        {
            return _ossRouteRepositrory.GetRoleRoutes(roleid);
        }
    }
}